require(["config"],function(){
    require(["jquery","template","header"],function($,template){
        function List(){
            this.renderList();
            this.addListener();
        }

        $.extend(List.prototype,{
            constructor: List,
            renderList: function(){
                $.ajax("http://rap2api.taobao.org/app/mock/86521/list/api")
                    .done(function(data){
                        var data = {list: data.res_body.list};
                        console.log(data);
                        var html = template("list_template",data);

                        $(".items-list").html(html);
                    })
            },
            addListener: function(){
                $(".aj").on("click",$.proxy(this.re,this));
            },

            re: function(){
                this.renderList();
            }
        });

        new List();
    });
});